package com.qfedu.mavenk.demo7;

import org.springframework.stereotype.Component;

/**
 * @author:huayuzhuo
 * @email:2798866329@qq.com
 * 面对切面的测试类
 * @datatime: 2022/10/24 14:26
 */
public class Logging {

    //advice 通知类型
    public void beforeAdvice(){
        System.out.println("Before Advice...");
    }

    public void afterAdvice(){
        System.out.println("After Advice...");
    }

    //afterReturningAdvice在连接点执行成功之后调用，返回结果注入到retVal参数
    public void afterReturningAdvice(Object retVal){
        System.out.println("After Advice Executed Successfully...Returning:" + retVal.toString());
    }

    //afterThrowingAdvice在连接点执行抛出异常之后调用，返回异常注入到retVal参数
    public void afterThrowingAdvice(Exception ex){
        System.out.println("After Advice Executed Successfully...Returning:" + ex.toString());
    }
}
